<HTML>
<HEAD>
<TITLE>[Chapter 19] Dialog</TITLE>
<META NAME="author" CONTENT="John Zukowski">
<META NAME="date" CONTENT="Thu Jul 31 15:11:43 1997">
<META NAME="form" CONTENT="html">
<META NAME="metadata" CONTENT="dublincore.0.1">
<META NAME="objecttype" CONTENT="book part">
<META NAME="otheragent" CONTENT="gmat dbtohtml">
<META NAME="publisher" CONTENT="O'Reilly &amp; Associates, Inc.">
<META NAME="source" CONTENT="SGML">
<META NAME="subject" CONTENT="Java AWT">
<META NAME="title" CONTENT="Java AWT">
<META HTTP-EQUIV="Content-Script-Type" CONTENT="text/javascript">
</HEAD>
<body vlink="#551a8b" alink="#ff0000" text="#000000" bgcolor="#FFFFFF" link="#0000ee">

<DIV CLASS=htmlnav>
<H1><a href='index.htm'><IMG SRC="gifs/smbanner.gif"
     ALT="Java AWT" border=0></a></H1>
<table width=515 border=0 cellpadding=0 cellspacing=0>
<tr>
<td width=172 align=left valign=top><A HREF="ch19_17.htm"><IMG SRC="gifs/txtpreva.gif" ALT="Previous" border=0></A></td>
<td width=171 align=center valign=top><B><FONT FACE="ARIEL,HELVETICA,HELV,SANSERIF" SIZE="-1">Chapter 19<br>java.awt Reference</FONT></B></TD>
<td width=172 align=right valign=top><A HREF="ch19_19.htm"><IMG SRC="gifs/txtnexta.gif" ALT="Next" border=0></A></td>
</tr>
</table>

&nbsp;
<hr align=left width=515>
</DIV>
<DIV CLASS=refnamediv>
<H1>Dialog</H1>

<H2>Name</H2>

Dialog

</DIV>

<DIV CLASS=refsect1>
<h2 CLASS=refsect1><A CLASS="TITLE" NAME="ch19-REFSECT1-AUTOID.18"></A></h2>
</DIV>


<p>
<img align=middle src="./figs/dialog.gif" alt="[Graphic: Figure from the text]" width=502 height=92 border=0>

</DIV>

<DIV CLASS=refsect1>
<h2 CLASS=refsect1><A CLASS="TITLE" NAME="JAWT-CH-19-REF-DIALOG-SECT-1">Description</A></h2>

<P CLASS=para>
The <tt CLASS=literal>Dialog</tt> class provides a 
special type of display window that is used for pop-up messages and acquiring 
input from the user. Unlike most other components, dialogs are hidden by 
default; you must call <tt CLASS=literal>show()</tt> 
to display them. Dialogs are always associated with a parent <tt CLASS=literal>Frame</tt>. 
A <tt CLASS=literal>Dialog</tt> may be either modal 
or non-modal; a modal dialog attracts all input typed by the user. The 
default layout for a <tt CLASS=literal>Dialog</tt> 
is <tt CLASS=literal>BorderLayout</tt>. 

</DIV>

<DIV CLASS=refsect1>
<h2 CLASS=refsect1><A CLASS="TITLE" NAME="JAWT-CH-19-REF-DIALOG-SECT-2">Class Definition</A></h2>

<DIV CLASS=screen>
<P>
<PRE>
public class java.awt.Dialog
    extends java.awt.Window {
  
  // Constructors
  public Dialog (Frame parent); <img src="gifs/bstar.gif" alt="(New)" border=0>
  public Dialog (Frame parent, boolean modal);
  public Dialog (Frame parent, String title); <img src="gifs/bstar.gif" alt="(New)" border=0>
  public Dialog (Frame parent, String title, boolean modal);
  
  // Instance Methods
  public void addNotify();
  public String getTitle();
  public boolean isModal();
  public boolean isResizable();
  public void setModal (boolean b); <img src="gifs/bstar.gif" alt="(New)" border=0>
  public synchronized void setResizable (boolean resizable);
  public synchronized void setTitle (String title);
  public void show();  <img src="gifs/bstar.gif" alt="(New)" border=0>
  
  // Protected Instance Methods
  protected String paramString();
}
</PRE>
</DIV>

</DIV>

<DIV CLASS=refsect1>
<h2 CLASS=refsect1><A CLASS="TITLE" NAME="JAWT-CH-19-REF-DIALOG-SECT-3">Constructors</A></h2>

<DIV CLASS=refsect2>
<h3 CLASS=refsect2><A CLASS="TITLE" NAME="JAWT-CH-19-REF-DIALOG-SECT-3.1">Dialog</A></h3>

<DIV CLASS=refsect3>
<h4 CLASS=refsect3><A CLASS="TITLE" NAME="JAWT-CH-19-REF-DIALOG-SECT-3.1.1">public Dialog (Frame parent) <img src="gifs/bstar.gif" alt="(New)" border=0></A></h4>

<DL CLASS=variablelist>
<DT CLASS=varlistentry>Parameters<br>
<DD>

<P>
<DL CLASS=variablelist>
<DT CLASS=varlistentry><I CLASS=emphasis>parent</I><br>
<DD>

<P CLASS=para>
<tt CLASS=literal>Frame</tt> that 
is to act as the parent of <tt CLASS=literal>Dialog</tt>. </DL>
<p>
<DT CLASS=varlistentry>Throws<br>
<DD>

<P>
<DL CLASS=variablelist>
<DT CLASS=varlistentry><tt CLASS=literal>IllegalArgumentException</tt><br>
<DD>

<P CLASS=para>
If 
<tt CLASS=literal>parent</tt> is <tt CLASS=literal>null</tt>. </DL>
<p>
<DT CLASS=varlistentry>Description<br>
<DD>

<P CLASS=para>
Constructs a <tt CLASS=literal>Dialog</tt> object. </DL>
</DIV>

<DIV CLASS=refsect3>
<h4 CLASS=refsect3><A CLASS="TITLE" NAME="JAWT-CH-19-REF-DIALOG-SECT-3.1.2">public Dialog (Frame parent, boolean modal)</A></h4>

<DL CLASS=variablelist>
<DT CLASS=varlistentry>Parameters<br>
<DD>

<P>
<DL CLASS=variablelist>
<DT CLASS=varlistentry><I CLASS=emphasis>parent</I><br>
<DD>

<P CLASS=para>
<tt CLASS=literal>Frame</tt> that 
is to act as the parent of <tt CLASS=literal>Dialog</tt>. 

<p>
<DT CLASS=varlistentry><I CLASS=emphasis>modal</I><br>
<DD>

<P CLASS=para>
<tt CLASS=literal>true</tt> if the 
<tt CLASS=literal>Dialog</tt> is modal; <tt CLASS=literal>false</tt> 
otherwise. </DL>
<p>
<DT CLASS=varlistentry>Throws<br>
<DD>

<P>
<DL CLASS=variablelist>
<DT CLASS=varlistentry><tt CLASS=literal>IllegalArgumentException</tt><br>
<DD>

<P CLASS=para>
If 
<tt CLASS=literal>parent</tt> is <tt CLASS=literal>null</tt>. </DL>
<p>
<DT CLASS=varlistentry>Description<br>
<DD>

<P CLASS=para>
Replaced with <tt CLASS=literal>Dialog(Frame, String, boolean)</tt>. </DL>
</DIV>

<DIV CLASS=refsect3>
<h4 CLASS=refsect3><A CLASS="TITLE" NAME="JAWT-CH-19-REF-DIALOG-SECT-3.1.3">public Dialog (Frame parent, String title) <img src="gifs/bstar.gif" alt="(New)" border=0></A></h4>

<DL CLASS=variablelist>
<DT CLASS=varlistentry>Parameters<br>
<DD>

<P>
<DL CLASS=variablelist>
<DT CLASS=varlistentry><I CLASS=emphasis>parent</I><br>
<DD>

<P CLASS=para>
<tt CLASS=literal>Frame</tt> that 
is to act as parent of <tt CLASS=literal>Dialog</tt>. 

<p>
<DT CLASS=varlistentry><I CLASS=emphasis>title</I><br>
<DD>

<P CLASS=para>
Initial title to use for <tt CLASS=literal>Dialog</tt>.</DL>
<p>
<DT CLASS=varlistentry>Throws<br>
<DD>

<P>
<DL CLASS=variablelist>
<DT CLASS=varlistentry><tt CLASS=literal>IllegalArgumentException</tt><br>
<DD>

<P CLASS=para>
If 
<tt CLASS=literal>parent</tt> is <tt CLASS=literal>null</tt>. </DL>
<p>
<DT CLASS=varlistentry>Description<br>
<DD>

<P CLASS=para>
Constructs a <tt CLASS=literal>Dialog</tt> object 
with given characteristics. </DL>
</DIV>

<DIV CLASS=refsect3>
<h4 CLASS=refsect3><A CLASS="TITLE" NAME="JAWT-CH-19-REF-DIALOG-SECT-3.1.4">public Dialog (Frame parent, String title, boolean modal)</A></h4>

<DL CLASS=variablelist>
<DT CLASS=varlistentry>Parameters<br>
<DD>

<P>
<DL CLASS=variablelist>
<DT CLASS=varlistentry><I CLASS=emphasis>parent</I><br>
<DD>

<P CLASS=para>
<tt CLASS=literal>Frame</tt> that 
is to act as parent of <tt CLASS=literal>Dialog</tt>. 

<p>
<DT CLASS=varlistentry><I CLASS=emphasis>title</I><br>
<DD>

<P CLASS=para>
Initial title to use for <tt CLASS=literal>Dialog</tt>.

<p>
<DT CLASS=varlistentry><I CLASS=emphasis>modal</I><br>
<DD>

<P CLASS=para>
<tt CLASS=literal>true</tt> if the 
<tt CLASS=literal>Dialog</tt> is modal; <tt CLASS=literal>false</tt> 
otherwise. </DL>
<p>
<DT CLASS=varlistentry>Throws<br>
<DD>

<P>
<DL CLASS=variablelist>
<DT CLASS=varlistentry><tt CLASS=literal>IllegalArgumentException</tt><br>
<DD>

<P CLASS=para>
If 
<tt CLASS=literal>parent</tt> is <tt CLASS=literal>null</tt>. </DL>
<p>
<DT CLASS=varlistentry>Description<br>
<DD>

<P CLASS=para>
Constructs a <tt CLASS=literal>Dialog</tt> object 
with given characteristics. </DL>
</DIV>

</DIV>

</DIV>

<DIV CLASS=refsect1>
<h2 CLASS=refsect1><A CLASS="TITLE" NAME="JAWT-CH-19-REF-DIALOG-SECT-4">Instance Methods</A></h2>

<DIV CLASS=refsect2>
<h3 CLASS=refsect2><A CLASS="TITLE" NAME="JAWT-CH-19-REF-DIALOG-SECT-4.1">addNotify</A></h3>

<DIV CLASS=refsect3>
<h4 CLASS=refsect3><A CLASS="TITLE" NAME="JAWT-CH-19-REF-DIALOG-SECT-4.1.1">public void addNotify()</A></h4>

<DL CLASS=variablelist>
<DT CLASS=varlistentry>Overrides<br>
<DD>

<P CLASS=para>
<tt CLASS=literal>Window.addNotify()</tt> 

<p>
<DT CLASS=varlistentry>Description<br>
<DD>

<P CLASS=para>
Creates <tt CLASS=literal>Dialog</tt>'s peer 
and peers of contained components. </DL>
</DIV>

</DIV>

<DIV CLASS=refsect2>
<h3 CLASS=refsect2><A CLASS="TITLE" NAME="JAWT-CH-19-REF-DIALOG-SECT-4.3">getTitle</A></h3>

<DIV CLASS=refsect3>
<h4 CLASS=refsect3><A CLASS="TITLE" NAME="JAWT-CH-19-REF-DIALOG-SECT-4.3.1">public String getTitle()</A></h4>

<DL CLASS=variablelist>
<DT CLASS=varlistentry>Returns<br>
<DD>

<P CLASS=para>
The current title for the <tt CLASS=literal>Dialog</tt>. </DL>
</DIV>

</DIV>

<DIV CLASS=refsect2>
<h3 CLASS=refsect2><A CLASS="TITLE" NAME="JAWT-CH-19-REF-DIALOG-SECT-4.4">isModal</A></h3>

<DIV CLASS=refsect3>
<h4 CLASS=refsect3><A CLASS="TITLE" NAME="JAWT-CH-19-REF-DIALOG-SECT-4.4.1">public boolean isModal()</A></h4>

<DL CLASS=variablelist>
<DT CLASS=varlistentry>Returns<br>
<DD>

<P CLASS=para>
<tt CLASS=literal>true</tt> if modal, <tt CLASS=literal>false</tt> 
otherwise. </DL>
</DIV>

</DIV>

<DIV CLASS=refsect2>
<h3 CLASS=refsect2><A CLASS="TITLE" NAME="JAWT-CH-19-REF-DIALOG-SECT-4.5">isResizable</A></h3>

<DIV CLASS=refsect3>
<h4 CLASS=refsect3><A CLASS="TITLE" NAME="JAWT-CH-19-REF-DIALOG-SECT-4.5.1">public boolean isResizable()</A></h4>

<DL CLASS=variablelist>
<DT CLASS=varlistentry>Returns<br>
<DD>

<P CLASS=para>
<tt CLASS=literal>true</tt> if resizable, <tt CLASS=literal>false</tt> 
otherwise. </DL>
</DIV>

</DIV>

<DIV CLASS=refsect2>
<h3 CLASS=refsect2><A CLASS="TITLE" NAME="JAWT-CH-19-REF-DIALOG-SECT-4.7">setModal</A></h3>

<DIV CLASS=refsect3>
<h4 CLASS=refsect3><A CLASS="TITLE" NAME="JAWT-CH-19-REF-DIALOG-SECT-4.7.1">public void setModal (boolean b) <img src="gifs/bstar.gif" alt="(New)" border=0></A></h4>

<DL CLASS=variablelist>
<DT CLASS=varlistentry>Parameters<br>
<DD>

<P>
<DL CLASS=variablelist>
<DT CLASS=varlistentry><I CLASS=emphasis>b</I><br>
<DD>

<P CLASS=para>
<tt CLASS=literal>true</tt> 
makes the <tt CLASS=literal>Dialog</tt> modal; <tt CLASS=literal>false</tt> 
if the <tt CLASS=literal>Dialog</tt> should be modeless. </DL>
<p>
<DT CLASS=varlistentry>Description<br>
<DD>

<P CLASS=para>
Changes the modal state of the <tt CLASS=literal>Dialog</tt>. </DL>
</DIV>

</DIV>

<DIV CLASS=refsect2>
<h3 CLASS=refsect2><A CLASS="TITLE" NAME="JAWT-CH-19-REF-DIALOG-SECT-4.8">setResizable</A></h3>

<DIV CLASS=refsect3>
<h4 CLASS=refsect3><A CLASS="TITLE" NAME="JAWT-CH-19-REF-DIALOG-SECT-4.8.1">public synchronized void setResizable (boolean resizable)</A></h4>

<DL CLASS=variablelist>
<DT CLASS=varlistentry>Parameters<br>
<DD>

<P>
<DL CLASS=variablelist>
<DT CLASS=varlistentry><I CLASS=emphasis>resizable</I><br>
<DD>

<P CLASS=para>
<tt CLASS=literal>true</tt> 
makes the <tt CLASS=literal>Dialog</tt> resizable; 
<tt CLASS=literal>false</tt> if the <tt CLASS=literal>Dialog</tt> 
cannot be resized. </DL>
<p>
<DT CLASS=varlistentry>Description<br>
<DD>

<P CLASS=para>
Changes the resize state of the <tt CLASS=literal>Dialog</tt>. </DL>
</DIV>

</DIV>

<DIV CLASS=refsect2>
<h3 CLASS=refsect2><A CLASS="TITLE" NAME="JAWT-CH-19-REF-DIALOG-SECT-4.9">setTitle</A></h3>

<DIV CLASS=refsect3>
<h4 CLASS=refsect3><A CLASS="TITLE" NAME="JAWT-CH-19-REF-DIALOG-SECT-4.9.1">public synchronized void setTitle (String title)</A></h4>

<DL CLASS=variablelist>
<DT CLASS=varlistentry>Parameters<br>
<DD>

<P>
<DL CLASS=variablelist>
<DT CLASS=varlistentry><I CLASS=emphasis>title</I><br>
<DD>

<P CLASS=para>
New title for the <tt CLASS=literal>Dialog</tt>.</DL>
<p>
<DT CLASS=varlistentry>Description<br>
<DD>

<P CLASS=para>
Changes the title of the <tt CLASS=literal>Dialog</tt>. </DL>
</DIV>

</DIV>

<DIV CLASS=refsect2>
<h3 CLASS=refsect2><A CLASS="TITLE" NAME="JAWT-CH-19-REF-DIALOG-SECT-4.10">show</A></h3>

<DIV CLASS=refsect3>
<h4 CLASS=refsect3><A CLASS="TITLE" NAME="JAWT-CH-19-REF-DIALOG-SECT-4.10.1">public void show() <img src="gifs/bstar.gif" alt="(New)" border=0></A></h4>

<DL CLASS=variablelist>
<DT CLASS=varlistentry>Overrides <br>
<DD>

<P CLASS=para>
<tt CLASS=literal>Window.show()</tt> 

<p>
<DT CLASS=varlistentry>Description<br>
<DD>

<P CLASS=para>
If the dialog is hidden, this method shows it. If the dialog is already 
visible, this method brings it to the front. </DL>
</DIV>

</DIV>

</DIV>

<DIV CLASS=refsect1>
<h2 CLASS=refsect1><A CLASS="TITLE" NAME="JAWT-CH-19-REF-DIALOG-SECT-5">Protected Instance Methods</A></h2>

<DIV CLASS=refsect2>
<h3 CLASS=refsect2><A CLASS="TITLE" NAME="JAWT-CH-19-REF-DIALOG-SECT-5.1">paramString</A></h3>

<DIV CLASS=refsect3>
<h4 CLASS=refsect3><A CLASS="TITLE" NAME="JAWT-CH-19-REF-DIALOG-SECT-5.1.1">protected String paramString()</A></h4>

<DL CLASS=variablelist>
<DT CLASS=varlistentry>Returns<br>
<DD>

<P CLASS=para>
String with current settings of <tt CLASS=literal>Dialog</tt>. 

<p>
<DT CLASS=varlistentry>Overrides <br>
<DD>

<P CLASS=para>
<tt CLASS=literal>Container.paramString()</tt> 

<p>
<DT CLASS=varlistentry>Description<br>
<DD>

<P CLASS=para>
Helper method for <tt CLASS=literal>toString()</tt> 
to generate string of current settings. </DL>
</DIV>

</DIV>

</DIV>

<DIV CLASS=refsect1>
<h2 CLASS=refsect1><A CLASS="TITLE" NAME="JAWT-CH-19-REF-DIALOG-SECT-6">See Also</A></h2>

<P CLASS=para>
<tt CLASS=literal>FileDialog</tt>, <tt CLASS=literal>Frame</tt>, 
<tt CLASS=literal>String</tt>, <tt CLASS=literal>Window</tt>, 
<tt CLASS=literal>WindowEvent</tt>, <tt CLASS=literal>WindowListener</tt> 

</DIV>


<DIV CLASS=htmlnav>

<P>
<HR align=left width=515>
<table width=515 border=0 cellpadding=0 cellspacing=0>
<tr>
<td width=172 align=left valign=top><A HREF="ch19_17.htm"><IMG SRC="gifs/txtpreva.gif" ALT="Previous" border=0></A></td>
<td width=171 align=center valign=top><a href="index.htm"><img src='gifs/txthome.gif' border=0 alt='Home'></a></td>
<td width=172 align=right valign=top><A HREF="ch19_19.htm"><IMG SRC="gifs/txtnexta.gif" ALT="Next" border=0></A></td>
</tr>
<tr>
<td width=172 align=left valign=top>Cursor <img src="gifs/bstar.gif" alt="(New)" border=0></td>
<td width=171 align=center valign=top><a href="index/idx_a.htm"><img src='gifs/index.gif' alt='Book Index' border=0></a></td>
<td width=172 align=right valign=top>Dimension</td>
</tr>
</table>
<hr align=left width=515>

<IMG SRC="gifs/smnavbar.gif" USEMAP="#map" BORDER=0> 
<MAP NAME="map"> 
<AREA SHAPE=RECT COORDS="0,0,108,15" HREF="../javanut/index.htm"
alt="Java in a Nutshell"> 
<AREA SHAPE=RECT COORDS="109,0,200,15" HREF="../langref/index.htm" 
alt="Java Language Reference"> 
<AREA SHAPE=RECT COORDS="203,0,290,15" HREF="../awt/index.htm" 
alt="Java AWT"> 
<AREA SHAPE=RECT COORDS="291,0,419,15" HREF="../fclass/index.htm" 
alt="Java Fundamental Classes"> 
<AREA SHAPE=RECT COORDS="421,0,514,15" HREF="../exp/index.htm" 
alt="Exploring Java"> 
</MAP>
</DIV>

</BODY>
</HTML>
